DetFit Tutorial

First, install DetFit7.m using the built in installation feature. Simply go to File -> Install... ->  Select “Package” for Type of Install” -> Select “From File...” under Source -> Select DetFit7.m -> Click “OK”

You have now installed DetFit!

Now Let’s Import DetFit using Get[ ]   or   << ... Note that the file name you call is DetFit7, not just DetFit

Get["DetFit7`"]

<<DetFit7`

Now that DetFit is imported into the kernel, we can use it to find the best fit for a straight line (and ONLY straight lines)

Let’s use some fairly linear data

Needs["ErrorBarPlots`"]
x={0.8,2.0,3.0,3.8,5.1,6.1};
y={4.3,5.6,12.3,13.0,18.7,19.1};
σ={1.5,2.1,1.3,2.3,2.8,1.6};
data=Table[{{x[[i]],y[[i]]},ErrorBar[σ[[i]]]},{i,1,Length[x]}];

Now let’s apply the function

?DetFit

a=DetFit[x,y,σ,0,7,PlotRange->All]

You will get only one real output, the print is simply just telling you your results in a nice way. The real data that you get from this is the nested list which is formatted in the following way: 
a = { { slope , intercept } , { δ slope , δ intercept } }

So the slope and intercept will be

a[[1]]

And the uncertainties will be

a[[2]]

Finally, we can use by parts to choose the specific part of the list we want

a[[1,1]]

So, let plot this.

Plot[2.124+(a[[1,2]]) x , {x,0,6.5},PlotRange->Automatic]